### standard glyphs, may be modifed at runtime by importing glyphs

import svg # don't use glyphs in anything that gets imported into svg.py!

# things that get attached to Curves as marks should assume that the line is horizontal, points to the right, and passes through 0
# these marks are effectively like Pins at (0,0)

farrowhead = svg.SVG("path", "M0 0L-0.5 -1.2 3 0 -0.5 1.2 0 0Z", stroke="none", fill="black")
farrowhead.repr = "<farrowhead>"

barrowhead = svg.SVG("path", "M0 0L0.5 -1.2 -3 0 0.5 1.2 0 0Z", stroke="none", fill="black")
barrowhead.repr = "<barrowhead>"

tick = svg.SVG("path", "M0 -1.5L0 1.5")
tick.repr = "<tick>"

minitick = svg.SVG("path", "M0 -0.75L0 0.75")
minitick.repr = "<minitick>"

frtick = svg.SVG("path", "M0 0L0 1.5")
frtick.repr = "<frtick>"

frminitick = svg.SVG("path", "M0 0L0 0.75")
frminitick.repr = "<frminitick>"

##############################################################################

# Map from standard LaTeX names to Unicode equivalents
# Values came from Steve's LaTeX-to-MathML translator (still organized like his page)
# Copyright (c) 2006 Steve Cheng <stevecheng@users.sourceforge.net>
# See http://www.gold-saucer.org/mathml/greasemonkey/dist/display-latex for details
latex = {
  # ellipsis
  "vdots": u"\u22ee",
  "hdots": u"\u2026",
  "ldots": u"\u2026",
  "dots": u"\u2026",
  "cdots": u"\u00b7\u00b7\u00b7",
  "dotsb": u"\u00b7\u00b7\u00b7",
  "dotsc": u"\u2026",
  "dotsi": u"\u22c5\u22c5\u22c5",
  "dotsm": u"\u22c5\u22c5\u22c5",
  "dotso": u"\u2026",
  "ddots": u"\u22f1",

  # delimiters
  "lvert": u"\u007c",
  "lVert": u"\u2016",
  "lceil": u"\u2308",
  "lfloor": u"\u230a",
  "lmoustache": u"\u23b0",
  "langle": u"\u2329",
  "rvert": u"\u007c",
  "rVert": u"\u2016",
  "rceil": u"\u2309",
  "rfloor": u"\u230b",
  "rmoustache": u"\u23b1",
  "rangle": u"\u232a",

  # TeX operator symbols
  "amalg": u"\u2a3f",
  "ast": u"\u002a",
  "barwedge": u"\u22bc",
  "bigcirc": u"\u25cb",
  "bigtriangledown": u"\u25bd",
  "bigtriangleup": u"\u25b3",
  "boxdot": u"\u22a1",
  "boxminus": u"\u229f",
  "boxplus": u"\u229e",
  "boxtimes": u"\u22a0",
  "bullet": u"\u2022",
  "cap": u"\u2229",
  "Cap": u"\u22d2",
  "cdot": u"\u22c5",
  "centerdot": u"\u00b7",
  "circ": u"\u2218",
  "circledast": u"\u229b",
  "circledcirc": u"\u229a",
  "circleddash": u"\u229d",
  "cup": u"\u222a",
  "Cup": u"\u22d3",
  "curlyvee": u"\u22ce",
  "curlywedge": u"\u22cf",
  "dagger": u"\u2020",
  "ddagger": u"\u2021",
  "diamond": u"\u22c4",
  "div": u"\u00f7",
  "divideontimes": u"\u22c7",
  "dotplus": u"\u2214",
  "doublebarwedge": u"\u2306",
  "doublecap": u"\u22d2",
  "doublecup": u"\u22d3",
  "gtrdot": u"\u22d7",
  "intercal": u"\u22ba",
  "land": u"\u2227",
  "leftthreetimes": u"\u22cb",
  "lessdot": u"\u22d6",
  "lor": u"\u2228",
  "ltimes": u"\u22c9",
  "mp": u"\u2213",
  "odot": u"\u2299",
  "ominus": u"\u2296",
  "oplus": u"\u2295",
  "oslash": u"\u2298",
  "otimes": u"\u2297",
  "pm": u"\u00b1",
  "rightthreetimes": u"\u22cc",
  "rtimes": u"\u22ca",
  "setminus": u"\u2216",
  "smallsetminus": u"\u2216",
  "sqcap": u"\u2293",
  "sqcup": u"\u2294",
  "star": u"\u22c6",
  "times": u"\u00d7",
  "triangleleft": u"\u25c1",
  "triangleright": u"\u25b7",
  "uplus": u"\u228e",
  "vee": u"\u2228",
  "veebar": u"\u22bb",
  "wedge": u"\u2227",
  "wr": u"\u2240",

  # operator characters
  "minus": u"\u2212",
  "slash": u"\u2215",
  "vert": u"\u007c",
  "Vert": u"\u2016",
  "|": u"\u2016",
  "backslash": u"\\",
  "'": u"\u2032",

  # big operators
  "bigcap": u"\u22c2",
  "bigcup": u"\u22c3",
  "bigodot": u"\u2a00",
  "bigoplus": u"\u2a01",
  "bigotimes": u"\u2a02",
  "bigsqcup": u"\u2a06",
  "biguplus": u"\u2a04",
  "bigvee": u"\u22c1",
  "bigwedge": u"\u22c0",
  "coprod": u"\u2210",
  "prod": u"\u220f",
  "sum": u"\u2211",
  "int": u"\u222b",
  "smallint": u"\u222b",
  "oint": u"\u222e",

  # miscellaneous simple symbols
  "angle": u"\u2220",
  "backprime": u"\u2035",
  "bigstar": u"\u2605",
  "blacklozenge": u"\u29eb",
  "blacksquare": u"\u25aa",
  "blacktriangle": u"\u25b4",
  "blacktriangledown": u"\u25be",
  "bot": u"\u22a5",
  "clubsuit": u"\u2663",
  "diagdown": u"\u2572",
  "diagup": u"\u2571",
  "diamondsuit": u"\u2662",
  "emptyset": u"\u2205",
  "exists": u"\u2203",
  "flat": u"\u266d",
  "forall": u"\u2200",
  "heartsuit": u"\u2661",
  "infty": u"\u221e",
  "lnot": u"\u00ac",
  "lozenge": u"\u25ca",
  "measuredangle": u"\u2221",
  "nabla": u"\u2207",
  "laplacian": u"\u2206",  # why is this missing from LaTeX?
  "natural": u"\u266e",
  "neg": u"\u00ac",
  "nexists": u"\u2204",
  "prime": u"\u2032",
  "qedsymbol": u"\u25a0",
  "sharp": u"\u266f",
  "spadesuit": u"\u2660",
  "sphericalangle": u"\u2222",
  "square": u"\u25a1",
  "surd": u"\u221a",
  "top": u"\u22a4",
  "triangle": u"\u25b5",
  "triangledown": u"\u25bf",
  "varnothing": u"\u2205",

  # other alphabetic symbols
  "aleph": u"\u2135",
  "Bbbk": u"\u1d55c",
  "beth": u"\u2136",
  "circledS": u"\u24c8",
  "complement": u"\u2201",
  "daleth": u"\u2138",
  "ell": u"\u2113",
  "eth": u"\u00f0",
  "Finv": u"\u2132",
  "Game": u"\u2141",
  "gimel": u"\u2137",
  "hbar": u"\u210f",
  "hslash": u"\u210f",
  "Im": u"\u2111",
  "mho": u"\u2127",
  "partial": u"\u2202",
  "Re": u"\u211c",
  "wp": u"\u2118",

  # comparison symbols
  "approx": u"\u2248",
  "approxeq": u"\u224a",
  "asymp": u"\u224d",
  "backsim": u"\u223d",
  "backsimeq": u"\u22cd",
  "bumpeq": u"\u224f",
  "Bumpeq": u"\u224e",
  "circeq": u"\u2257",
  "cong": u"\u2245",
  "curlyeqprec": u"\u22de",
  "curlyeqsucc": u"\u22df",
  "doteq": u"\u2250",
  "doteqdot": u"\u2251",
  "eqcirc": u"\u2256",
  "eqsim": u"\u2242",
  "eqslantgtr": u"\u2a96",
  "eqslantless": u"\u2a95",
  "equiv": u"\u2261",
  "fallingdotseq": u"\u2252",
  "ge": u"\u2265",
  "geq": u"\u2265",
  "geqq": u"\u2267",
  "geqslant": u"\u2a7e",
  "gg": u"\u226b",
  "ggg": u"\u22d9",
  "gggtr": u"\u22d9",
  "gnapprox": u"\u2a8a",
  "gneq": u"\u2a88",
  "gneqq": u"\u2269",
  "gnsim": u"\u22e7",
  "gtrapprox": u"\u2a86",
  "gtreqless": u"\u22db",
  "gtreqqless": u"\u2a8c",
  "gtrless": u"\u2277",
  "gtrsim": u"\u2273",
  "gvertneqq": u"\u2269",
  "le": u"\u2264",
  "leq": u"\u2264",
  "leqq": u"\u2266",
  "leqslant": u"\u2a7d",
  "lessapprox": u"\u2a85",
  "lesseqgtr": u"\u22da",
  "lesseqqgtr": u"\u2a8b",
  "lessgtr": u"\u2276",
  "lesssim": u"\u2272",
  "ll": u"\u226a",
  "llless": u"\u22d8",
  "lnapprox": u"\u2a89",
  "lneq": u"\u2a87",
  "lneqq": u"\u2268",
  "lnsim": u"\u22e6",
  "lvertneqq": u"\u2268",
  "ncong": u"\u2247",
  "ne": u"\u2260",
  "neq": u"\u2260",
  "ngeq": u"\u2271",
  "ngeqq": u"\u2267",
  "ngeqslant": u"\u2a7e",
  "ngtr": u"\u226f",
  "nleq": u"\u2270",
  "nleqq": u"\u2266",
  "nleqslant": u"\u2a7d",
  "nless": u"\u226e",
  "nprec": u"\u2280",
  "npreceq": u"\u2aaf",
  "nsim": u"\u2241",
  "nsucc": u"\u2281",
  "nsucceq": u"\u2ab0",
  "prec": u"\u227a",
  "precapprox": u"\u2ab7",
  "preccurlyeq": u"\u227c",
  "preceq": u"\u2aaf",
  "precnapprox": u"\u2ab9",
  "precneqq": u"\u2ab5",
  "precnsim": u"\u22e8",
  "precsim": u"\u227e",
  "risingdotseq": u"\u2253",
  "sim": u"\u223c",
  "simeq": u"\u2243",
  "succ": u"\u227b",
  "succapprox": u"\u2ab8",
  "succcurlyeq": u"\u227d",
  "succeq": u"\u2ab0",
  "succnapprox": u"\u2aba",
  "succneqq": u"\u2ab6",
  "succnsim": u"\u22e9",
  "succsim": u"\u227f",
  "thickapprox": u"\u2248",
  "thicksim": u"\u223c",
  "triangleq": u"\u225c",

  # miscellaneous
  "backepsilon": u"\u03f6",
  "because": u"\u2235",
  "between": u"\u226c",
  "blacktriangleleft": u"\u25c0",
  "blacktriangleright": u"\u25b6",
  "bowtie": u"\u22c8",
  "dashv": u"\u22a3",
  "frown": u"\u2323",
  "in": u"\u220a",
  "mid": u"\u2223",
  "models": u"\u22a7",
  "ni": u"\u220b",
  "nmid": u"\u2224",
  "notin": u"\u2209",
  "nparallel": u"\u2226",
  "nshortmid": u"\u2224",
  "nshortparallel": u"\u2226",
  "subseteq": u"\u2286",
  "nsubseteq": u"\u2288",
  "nsubseteqq": u"\u2ac5",
  "supseteq": u"\u2287",
  "nsupseteq": u"\u2289",
  "nsupseteqq": u"\u2ac6",
  "ntriangleleft": u"\u22ea",
  "ntrianglelefteq": u"\u22ec",
  "ntriangleright": u"\u22eb",
  "ntrianglerighteq": u"\u22ed",
  "nvdash": u"\u22ac",
  "nvDash": u"\u22ad",
  "nVdash": u"\u22ae",
  "nVDash": u"\u22af",
  "owns": u"\u220d",
  "parallel": u"\u2225",
  "perp": u"\u22a5",
  "pitchfork": u"\u22d4",
  "propto": u"\u221d",
  "shortmid": u"\u2223",
  "shortparallel": u"\u2225",
  "smallfrown": u"\u2322",
  "smallsmile": u"\u2323",
  "smile": u"\u2323",
  "sqsubset": u"\u228f",
  "sqsubseteq": u"\u2291",
  "sqsupset": u"\u2290",
  "sqsupseteq": u"\u2292",
  "subset": u"\u2282",
  "Subset": u"\u22d0",
  "subseteq": u"\u2286",
  "subseteqq": u"\u2ac5",
  "subsetneq": u"\u228a",
  "subsetneqq": u"\u2acb",
  "supset": u"\u2283",
  "Supset": u"\u22d1",
  "supseteq": u"\u2287",
  "supseteqq": u"\u2ac6",
  "supsetneq": u"\u228b",
  "supsetneqq": u"\u2acc",
  "therefore": u"\u2234",
  "trianglelefteq": u"\u22b4",
  "trianglerighteq": u"\u22b5",
  "varpropto": u"\u221d",
  "varsubsetneq": u"\u228a",
  "varsubsetneqq": u"\u2acb",
  "varsupsetneq": u"\u228b",
  "varsupsetneqq": u"\u2acc",
  "vartriangle": u"\u25b5",
  "vartriangleleft": u"\u22b2",
  "vartriangleright": u"\u22b3",
  "vdash": u"\u22a2",
  "vDash": u"\u22a8",
  "Vdash": u"\u22a9",
  "Vvdash": u"\u22aa",

  # arrows
  "downarrow": u"\u2193",
  "Downarrow": u"\u21d3",
  "uparrow": u"\u2191",
  "Uparrow": u"\u21d1",
  "updownarrow": u"\u2195",
  "Updownarrow": u"\u21d5",
  "curvearrowleft": u"\u21b6",
  "curvearrowright": u"\u21b7",
  "downdownarrows": u"\u21ca",
  "downharpoonleft": u"\u21c3",
  "downharpoonright": u"\u21c2",
  "gets": u"\u2190",
  "hookleftarrow": u"\u21a9",
  "hookrightarrow": u"\u21aa",
  "leftarrow": u"\u2190",
  "Leftarrow": u"\u21d0",
  "leftarrowtail": u"\u21a2",
  "leftharpoondown": u"\u21bd",
  "leftharpoonup": u"\u21bc",
  "leftleftarrows": u"\u21c7",
  "leftrightarrow": u"\u2194",
  "leftrightarrows": u"\u21c6",
  "leftrightharpoons": u"\u21cb",
  "leftrightsquigarrow": u"\u21ad",
  "Lleftarrow": u"\u21da",
  "longleftarrow": u"\u27f5",
  "Longleftarrow": u"\u27f8",
  "longleftrightarrow": u"\u27f7",
  "Longleftrightarrow": u"\u27fa",
  "looparrowleft": u"\u21ab",
  "looparrowright": u"\u21ac",
  "Lsh": u"\u21b0",
  "mapsto": u"\u21a6",
  "multimap": u"\u22b8",
  "nearrow": u"\u2197",
  "nleftarrow": u"\u219a",
  "nLeftarrow": u"\u21cd",
  "nleftrightarrow": u"\u21ae",
  "nLeftrightarrow": u"\u21ce",
  "nrightarrow": u"\u219b",
  "nRightarrow": u"\u21cf",
  "nwarrow": u"\u2196",
  "restriction": u"\u21be",
  "rightarrow": u"\u2192",
  "Rightarrow": u"\u21d2",
  "rightarrowtail": u"\u21a3",
  "rightharpoondown": u"\u21c1",
  "rightharpoonup": u"\u21c0",
  "rightleftarrows": u"\u21c4",
  "rightleftharpoons": u"\u21cc",
  "rightrightarrows": u"\u21c9",
  "rightsquigarrow": u"\u219d",
  "Rrightarrow": u"\u21db",
  "Rsh": u"\u21b1",
  "searrow": u"\u2198",
  "swarrow": u"\u2199",
  "to": u"\u2192",
  "twoheadleftarrow": u"\u219e",
  "twoheadrightarrow": u"\u21a0",
  "upharpoonleft": u"\u21bf",
  "upharpoonright": u"\u21be",
  "upuparrows": u"\u21c8",

  # accents and braces (use after the letter you want to modify; not
  # all of these work well, and they usually don't work at all in the
  # interactive viewer)
  "acute": u"\u0301",
  "grave": u"\u0300",
  "tilde": u"\u0303",
  "bar": u"\u0304",
  "breve": u"\u0306",
  "check": u"\u030c",
  "hat": u"\u0302",
  "vec": u"\u20d7",
  "dot": u"\u0307",
  "ddot": u"\u0308",
  "dddot": u"\u20db",
  "underbrace": u"\ufe38",
  "overbrace": u"\ufe37",
  "underline": u"\u0332",
  "overline": u"\u00af",
  "widetilde": u"\u0303",
  "widehat": u"\u0302",
  "not": u"\u0338",

  # greek alphabet (for math)
  "alpha": u"\u03b1",
  "beta": u"\u03b2",
  "chi": u"\u03c7",
  "delta": u"\u03b4",
  "Delta": u"\u0394",
  "digamma": u"\u03dd",
  "epsilon": u"\u03f5",
  "eta": u"\u03b7",
  "gamma": u"\u03b3",
  "Gamma": u"\u0393",
  "iota": u"\u03b9",
  "kappa": u"\u03ba",
  "lambda": u"\u03bb",
  "Lambda": u"\u039b",
  "mu": u"\u03bc",
  "nu": u"\u03bd",
  "omega": u"\u03c9",
  "Omega": u"\u03a9",
  "phi": u"\u03c6",
  "Phi": u"\u03a6",
  "pi": u"\u03c0",
  "Pi": u"\u03a0",
  "psi": u"\u03c8",
  "Psi": u"\u03a8",
  "rho": u"\u03c1",
  "sigma": u"\u03c3",
  "Sigma": u"\u03a3",
  "tau": u"\u03c4",
  "theta": u"\u03b8",
  "Theta": u"\u0398",
  "upsilon": u"\u03c5",
  "Upsilon": u"\u03d2",
  "varepsilon": u"\u03b5",
  "varkappa": u"\u03f0",
  "varphi": u"\u03d5",
  "varpi": u"\u03d6",
  "varrho": u"\u03f1",
  "varsigma": u"\u03c2",
  "vartheta": u"\u03d1",
  "xi": u"\u03be",
  "Xi": u"\u039e",
  "zeta": u"\u03b6",
}

greek = {
  # Greek alphabet (uppercase)
  "Alpha": u"\u0391",
  "Beta": u"\u0392",
  "Gamma": u"\u0393",
  "Delta": u"\u0394",
  "Epsilon": u"\u0395",
  "Zeta": u"\u0396",
  "Eta": u"\u0397",
  "Theta": u"\u0398",
  "Iota": u"\u0399",
  "Kappa": u"\u039a",
  "Lamda": u"\u039b",
  "Mu": u"\u039c",
  "Nu": u"\u039d",
  "Xi": u"\u039e",
  "Omicron": u"\u039f",
  "Pi": u"\u03a0",
  "Rho": u"\u03a1",
  "Sigma": u"\u03a3",
  "Tau": u"\u03a4",
  "Upsilon": u"\u03a5",
  "Phi": u"\u03a6",
  "Chi": u"\u03a7",
  "Psi": u"\u03a8",
  "Omega": u"\u03a9",

  # Greek alphabet (lowercase)
  "alpha": u"\u03b1",
  "beta": u"\u03b2",
  "gamma": u"\u03b3",
  "delta": u"\u03b4",
  "epsilon": u"\u03b5",
  "zeta": u"\u03b6",
  "eta": u"\u03b7",
  "theta": u"\u03b8",
  "iota": u"\u03b9",
  "kappa": u"\u03ba",
  "lamda": u"\u03bb",
  "mu": u"\u03bc",
  "nu": u"\u03bd",
  "xi": u"\u03be",
  "omicron": u"\u03bf",
  "pi": u"\u03c0",
  "rho": u"\u03c1",
  "finalsigma": u"\u03c2",
  "sigma": u"\u03c3",
  "tau": u"\u03c4",
  "upsilon": u"\u03c5",
  "phi": u"\u03c6",
  "chi": u"\u03c7",
  "psi": u"\u03c8",
  "omega": u"\u03c9",
}

hebrew = {
  # Hebrew alphabet
  "Alef": u"\u05d0",
  "Bet": u"\u05d1",
  "Gimel": u"\u05d2",
  "Dalet": u"\u05d3",
  "He": u"\u05d4",
  "Vav": u"\u05d5",
  "Zayin": u"\u05d6",
  "Het": u"\u05d7",
  "Tet": u"\u05d8",
  "Yod": u"\u05d9",
  "FinalKaf": u"\u05da",
  "Kaf": u"\u05db",
  "Lamed": u"\u05dc",
  "FinalMem": u"\u05dd",
  "Mem": u"\u05de",
  "FinalNun": u"\u05df",
  "Nun": u"\u05e0",
  "Samekh": u"\u05e1",
  "Ayin": u"\u05e2",
  "FinalPe": u"\u05e3",
  "Pe": u"\u05e4",
  "FinalTsadi": u"\u05e5",
  "Tsadi": u"\u05e6",
  "Qof": u"\u05e7",
  "Resh": u"\u05e8",
  "Shin": u"\u05e9",
  "Tav": u"\u05ea",
}

cyrillic = {
  # Cyrillic alphabet (uppercase)
  "A": u"\u0410",
  "Be": u"\u0411",
  "Ve": u"\u0412",
  "Ghe": u"\u0413",
  "De": u"\u0414",
  "Ie": u"\u0415",
  "Zhe": u"\u0416",
  "Ze": u"\u0417",
  "I": u"\u0418",
  "ShortI": u"\u0419",
  "Ka": u"\u041a",
  "El": u"\u041b",
  "Em": u"\u041c",
  "En": u"\u041d",
  "O": u"\u041e",
  "Pe": u"\u041f",
  "Er": u"\u0420",
  "Es": u"\u0421",
  "Te": u"\u0422",
  "U": u"\u0423",
  "Ef": u"\u0424",
  "Ha": u"\u0425",
  "Tse": u"\u0426",
  "Che": u"\u0427",
  "Sha": u"\u0428",
  "Shcha": u"\u0429",
  "HardSign": u"\u042a",
  "Yeru": u"\u042b",
  "SoftSign": u"\u042c",
  "E": u"\u042d",
  "Yu": u"\u042e",
  "Ya": u"\u042f",

  # Cyrillic alphabet (lowercase)
  "a": u"\u0430",
  "be": u"\u0431",
  "ve": u"\u0432",
  "ghe": u"\u0433",
  "de": u"\u0434",
  "ie": u"\u0435",
  "zhe": u"\u0436",
  "ze": u"\u0437",
  "i": u"\u0438",
  "shorti": u"\u0439",
  "ka": u"\u043a",
  "el": u"\u043b",
  "em": u"\u043c",
  "en": u"\u043d",
  "o": u"\u043e",
  "pe": u"\u043f",
  "er": u"\u0440",
  "es": u"\u0441",
  "te": u"\u0442",
  "u": u"\u0443",
  "ef": u"\u0444",
  "ha": u"\u0445",
  "tse": u"\u0446",
  "che": u"\u0447",
  "sha": u"\u0448",
  "shcha": u"\u0449",
  "hardsign": u"\u044a",
  "yeru": u"\u044b",
  "softsign": u"\u044c",
  "e": u"\u044d",
  "yu": u"\u044e",
  "ya": u"\u044f",
}

currency = {
  # currencies
  "cent": u"\u20b5",
  "dollar": u"$",
  "dong": u"\u20ab",
  "euro": u"\u20ac",
  "florin": u"\u20a3",
  "lira": u"\u20a4",
  "naira": u"\u20a6",
  "won": u"\u20a9",
  "sterling": u"\u00a3",
  "yen": u"\u00a5",
}
